home *** CD-ROM | disk | FTP | other *** search
- Path: hamlet.uncg.edu!q_zhong
- From: "QIAN . ZHONG" <q_zhong@hamlet.uncg.edu>
- Newsgroups: comp.lang.c++
- Subject: good delete questions
- Date: Wed, 6 Mar 1996 17:32:52 -0500
- Organization: The University of North Carolina at Greensboro
- Message-ID: <Pine.SOL.3.91.960306171540.26843A-100000@hamlet.uncg.edu>
- NNTP-Posting-Host: hamlet.uncg.edu
- Mime-Version: 1.0
- Content-Type: TEXT/PLAIN; charset=US-ASCII
-
-
- Hi, folks:
-
- A couple questions about delete operator.
- 1. delete can be overrided, but not overloaded, any other operator does
- same thing ? I mean for global operator. Can free() be overrided ?
- 2. Check the simple code:
- char *pc = new char;
- char *pc2 = pc;
- *pc = 'a';
- delete pc; // so far, everything is fine.
- putchar(*pc2); // I found pc2 still pointed to the same address
- // just like before delete, but value already
- // changed, does OS or compiler or whatever
- // did anything here ? why pointed
- // value change, I know I should not
- // use any released memory, I just
- // want to know what is actully happening
- // here ? For DOS, as I know
- // delete -call-> free -call ->bios,
- // then what ?
-
- Please send me mail. Thanks
-
- Qian
-